package lab02.test05;
//定义一个立方体的长，宽，高
public class Cubic {
    float height ;
    float width;
    float longth;
    //构造方法
    public Cubic(){
    }
    //构造有参,将其初始化
    public Cubic(float height,float width,float longth){
        this.height = height;
        this.width = width;
        this.longth = longth;
    }
//通过get，set，方法来获取长，宽，高
    public void setHeight(float height) { this.height = height; }
    public float getHeight() { return height; }

    public void setLongth(float longth) { this.longth = longth; }
    public float getLongth() { return longth; }

    public void setWidth(float width) { this.width = width; }
    public float getWidth(){ return width; }

    //计算立方体体积
    public void Volume(){
        float volume;
       volume = height*longth*width;
       System.out.println("该立方体体积："+volume);
    }
}
